﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CrossLayerCommunication.FluentValidation;

namespace UnitTest.FluentValidation
{
    [TestClass]
    public class TestIsLengthNotEqualTo
    {
        [TestMethod]
        public void TestList()
        {
            //arrange
            List<int> valueToTest = new List<int> { 1, 2, 3, 4 };
            
            //act, assert
            Assert.IsTrue(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(3).ValidationWasSuccessful);
            Assert.IsFalse(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(4).ValidationWasSuccessful);
            Assert.IsTrue(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(5).ValidationWasSuccessful);
        }

        [TestMethod]
        public void TestArray()
        {
            //arrange
            int[] valueToTest = new int[4] { 1, 2, 3, 4 };

            //act, assert
            Assert.IsTrue(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(3).ValidationWasSuccessful);
            Assert.IsFalse(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(4).ValidationWasSuccessful);
            Assert.IsTrue(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(5).ValidationWasSuccessful);
        }

        [TestMethod]
        public void TestString()
        {
            //arrange
            string valueToTest = "testing";

            //act, assert
            Assert.IsTrue(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(6).ValidationWasSuccessful);
            Assert.IsFalse(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(7).ValidationWasSuccessful);
            Assert.IsTrue(valueToTest.TestingFluentValidation().IsLengthNotEqualTo(8).ValidationWasSuccessful);
        }
    }
}
